package partlow.yelp.parsers;

import org.json.JSONException;
import org.json.JSONObject;

import partlow.yelp.datatypes.YelpCoordinate;

public class CoordinateParser extends YelpTypeParser<YelpCoordinate> {

	@Override
	public YelpCoordinate parse(JSONObject json) throws JSONException {
		YelpCoordinate obj = new YelpCoordinate();
		if(json.has("latitude"))
        	obj.setLatitude(json.getDouble("latitude"));
		if(json.has("longitude"))
        	obj.setLongitude(json.getDouble("longitude"));
		
		return obj;
	}

}
